package com.example.administrator.test;

import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;

import java.util.ArrayList;

public class Slider2Activity extends AppCompatActivity {
    private ViewPager viewPager2;
    private ArrayList<View> aList;
    private MyPagerAdapter mAdapter;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_slider2);

        viewPager2 = (ViewPager) findViewById(R.id.viewPager2);
        aList = new ArrayList<View>();
        LayoutInflater li = getLayoutInflater();
        aList.add(li.inflate(R.layout.view1,null,false));
        aList.add(li.inflate(R.layout.view2,null,false));
        aList.add(li.inflate(R.layout.view3,null,false));
        aList.add(li.inflate(R.layout.view4,null,false));
        mAdapter = new MyPagerAdapter(aList);
        viewPager2.setAdapter(mAdapter);
    }
}
